<?php

namespace backend\models;

use Yii;

class User extends \common\models\User
{
    /**
     *  @brief 根据用户角色权限获取导航菜单
     *  
     *  @return 关联数组，[菜单名 => url|[icon,url,children], ... ]
     */
    public function getNavMenu(){
        static $navMenu = [
            '学校管理' => [
                'icon' => 'home',
                'children' => [
                    '学校查询' => '/school/index',
                    '资料审核' => '/school/audit',
                ]
            ],
            '专业管理' => [
                'icon' => 'app',
                'children' => [
                    '专业查询' => '/major/index',
                    '专业审核' => '/major/audit',
                ]
            ],
            '教师管理' => [
                'icon' => 'user',
                'url'  => '/teacher/index',
            ],
            '招生管理' => [
                'icon' => 'component',
                'children' => [
                    '招生查询' => 'demo/views/app/content/list.html',
                    '招生审核' => 'demo/views/app/content/tags.html',
                ]
            ],
            '学籍管理' => [
                'icon' => 'tabs',
                'children' => [
                    '学籍查重' => '/student-status/index',
                    '学籍异动' => '/student-status/change',
                    '学籍统计' => 'demo/views/senior/echarts/bar.html',
                ]
            ],
            '课程管理' => [
                'icon' => 'read',
                'children' => [
                    '开课查询' => '/term-course/index',
                    '选修查询' => '/elective/index',
                ]
            ],
            '毕业管理' => [
                'icon' => 'template-1',
                'children' => [
                    '毕业资格审核' => '/graduation-audit/index',
                    '毕业证管理' => '/diploma/index',
                ]
            ],
            '系统管理' => [
                'icon' => 'util',
                'children' => [
                    '消息公告' => [
                        '公告管理' => 'demo/views/app/message/index.html',
                        '消息管理' => 'demo/views/app/message/index.html',
                    ],
                    '用户管理' => [
                        '用户管理' => 'demo/views/user/administrators/list.html',
                        '角色管理' => 'demo/views/user/administrators/role.html',
                        '授权管理' => 'demo/views/user/administrators/role.html',
                    ],
                    '系统设置' => [
                        '毕业证模板' => 'demo/views/set/system/website.html',
                        '账号安全'   => 'demo/views/set/system/website.html',
                        '短信平台'   => 'demo/views/set/system/email.html',
                        '系统邮箱'   => 'demo/views/set/system/email.html',
                        '备份设置'   => 'demo/views/set/system/website.html',
                        '杂项'       => 'demo/views/set/system/website.html',
                    ],
                    '字典管理' => [
                        '专业目录'     => 'demo/views/user/administrators/list.html',
                        '行业名称代码' => 'demo/views/user/administrators/role.html',
                        '专业类别代码' => 'demo/views/user/administrators/role.html',
                        '专业类别代码' => 'demo/views/user/administrators/role.html',
                        '课程性质代码' => 'demo/views/user/administrators/role.html',
                        '学籍状态代码' => 'demo/views/user/administrators/role.html',
                    ],
                    'API接入管理' => [
                        '应用管理' => 'demo/views/user/user/list.html',
                        '授权管理' => 'demo/views/user/administrators/role.html',
                    ],
                    '数据备份' => [
                        '备份' => 'demo/views/app/workorder/list.html',
                        '恢复' => 'demo/views/app/workorder/list.html',
                    ],
                    '系统日志' => 'demo/views/app/message/index.html',
                ]
            ],
        ];
        
        // todo 从导航菜单中，根据权限筛选出可用的菜单项
        
        return $navMenu;
    }
}